FROM node:6.9.5

COPY package.json /var/www/
COPY . /var/www/

RUN cd /var/www \
    && npm install --global rimraf \
    && npm run clean \
    && npm install --global webpack webpack-dev-server typescript@2.0.3 \
    && npm install \
    && npm run prebuild:prod && npm run build:prod

WORKDIR /var/www
ENTRYPOINT ["npm", "run", "server:prod"]
